package com.ck.websocket.controller;

import com.ck.websocket.config.WebSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author ck
 * @date 2023/6/21 9:11
 */
@RestController
@RequestMapping("/websocketTest")
public class WebSocketController {

    @Autowired
    private WebSocket webSocket;


    @PostMapping("/send")
    public void send() throws InterruptedException, IOException {
            String msg = "";
            webSocket.sendMessageAll(msg,"chang");
        }
    }